<html>
    <head>
        <title></title>

        <?php
            if (isset($_POST['currpage']))
                $page = $_POST['currpage'];

            if (isset($_POST['curridx']))
                $idx = $_POST['curridx'];
        ?>

        <script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>

        <script type="text/javascript">
            $(document).ready(function () {
                //alert('j');
                //document.location='packagelist.php';
                document.location='packagelist.php?p='+<?php echo $page; ?>+'&r='+<?php echo $idx; ?>;
                //alert('packagelist.php?p=<?php echo $page; ?>&r=<?php echo $idx; ?>');
            });
        </script>
    </head>
    <body>
        <?php
        include('inc/init.php');

        $save_mode = 'n';
        if (isset($_POST['save_mode']))
            $save_mode = $_POST['save_mode'];



        if ($save_mode == 'u') {
            $sql = "UPDATE ats_package  
                    SET 
                      title = '" . $_POST['txtTitle'] . "',
                      monthstart = '" . $_POST['monthStart'] . "',
                      monthend = '" . $_POST['monthEnd'] . "',
                      yearstart = '" . $_POST['yearStart'] . "',
                      yearend = '" . $_POST['yearEnd'] . "',
                      isspecialoffer = '" . $_POST['isspecialoffer'] . "',
                      image = '" . $_POST['txtimgfile'] . "',
                      currency = '" . $_POST['txtCurrency'] . "',
                      pricestart = '" . $_POST['txtPrice'] . "',
                      dest_id = '" . $_POST['optDest'] . "',
                      cat_id = '" . $_POST['optCat'] . "',
                      ov_title = '" . $_POST['txtOvTitle'] . "',
                      ov_period = '" . $_POST['txtOvPeriod'] . "',
                      ov_bonus = '" . $_POST['txtOvBonus'] . "',
                      ov_highlight = '" . $_POST['txtOvHighlight'] . "',
                      ov_notice = '" . $_POST['txtOvNotice'] . "',
                      da_depdate = '" . $_POST['txtDaDepdate'] . "',
                      da_pricelabel = '" . $_POST['txtDaPriceLabel'] . "',
                      da_extraprice = '" . $_POST['txtDaExtraPrices'] . "',
                      tr_embaddress = '" . $_POST['txtTrEmbAddress'] . "',
                      tr_embphone = '" . $_POST['txtTrEmbPhone'] . "',
                      tr_embfax = '" . $_POST['txtTrEmbFax'] . "',
                      tr_requirement = '" . $_POST['txtTrReq'] . "',
                      tr_notes = '" . $_POST['txtTrNotes'] . "',
                      pdf_attachment = '".$_POST['pdf_attachment']."'
                    WHERE id = '" . $_POST['txtid'] . "'";
        } else {
            $sql = "update ats_package set title='test update title' where id=6";
        }

        //echo $sql;
        $query = $db->prepare($sql);
        $query->execute();
        ?>
    </body>
</html>